<script setup lang="ts">
import { BrandSeriesApi } from '@/api/aib/brandseries';

defineOptions({ name: 'SelectBrandSeriesCom' })
const brandSeriesId = defineModel("value");
const brandSeriesOptions = ref([]) // 列表的数据

const props = defineProps(['brandId'])

onMounted(() => {
  getList();
})

watchEffect(() => {
  if (props.brandId) {
    brandSeriesId.value = undefined;
    getList();
  }
})

/** 查询列表 */
const getList = async () => {
  const params = {
    brandId: props.brandId
  };
  brandSeriesOptions.value = await BrandSeriesApi.getBrandSeriesSimpleList(params)
}

</script>

<template>
  <el-select v-model="brandSeriesId" clearable placeholder="请选择产品系列" filterable>
    <el-option v-for="brand in brandSeriesOptions"
               :key="brand.id" :label="brand.name" :value="brand.id"/>
  </el-select>
</template>

<style scoped lang="scss">
.content {
  overflow: hidden;
}
</style>
